Page({
  data: {
    coupons: [
      {
        img: '/pages/coupon-list/coffee.png',
        title: '瑞幸-耶加雪菲·美式',
        want: 225,
        price: 1,
        subsidy: 8.67,
        save: 16
      },
      {
        img: '/pages/coupon-list/chicken.png',
        title: '麦当劳-小食甜品-那么大鸡排',
        want: 262,
        price: 1,
        subsidy: 7,
        save: 12
      },
      {
        img: '/pages/coupon-list/mango.png',
        title: '芒果TV-VIP会员-月卡',
        want: 63,
        price: 1,
        subsidy: 9.16,
        save: 29
      },
      {
        img: '/pages/coupon-list/vip.png',
        title: '剪映-普通会员-周卡',
        want: 9776,
        price: 1,
        subsidy: 0,
        save: 0
      }
    ]
  },
  goHome() {
    wx.redirectTo({ url: '/pages/index/index' })
  },
  onCouponTap(e) {
    const idx = e.currentTarget.dataset.index;
    const item = this.data.coupons[idx];
    if (item.title === '剪映-普通会员-周卡') {
      wx.navigateTo({ url: '/pages/coupon-detail/index' });
    }
  }
}) 